import 'dart:async';

import 'package:flutter/services.dart';

class PaddleFace {
  static const MethodChannel _channel = const MethodChannel('paddle_face');

  static Future<String> get platformVersion async {
    final String version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  static Future<dynamic> getFaceCount(String imagePath) async {
    try {
      final int faceCount = await _channel.invokeMethod('getFaceCount', {'imagePath': imagePath});
      return {"success": true, "message": "识别成功", "faceCount": faceCount};
    } catch (e) {
      if (e is PlatformException) {
        return {"success": false, "message": e.message, "faceCount": 0};
      }
      return {"success": false, "message": e.toString(), "faceCount": 0};
    }
  }
}
